﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Palluk.PassMaster.Passwords
{
    /// <summary>
    /// Define the password agreements for password building and checking
    /// </summary>
    public struct Contract
    {      
        private int _min;
        /// <summary>
        /// Minimum password lenght.
        /// </summary>
        public int Min
        {
            get { return _min; }
            set { _min = value; }
        }

        private int _max;
        /// <summary>
        /// Maximum password lenght.
        /// </summary>
        public int Max
        {
            get { return _max; }
            set { _max = value; }
        }

        /// <summary>
        /// Number of numeric chars.
        /// </summary>
        public int numerics;

        /// <summary>
        /// Number of upcases chars.
        /// </summary>
        public int upcases;

        /// <summary>
        /// Number of symbols chars.
        /// </summary>
        public int symbols;

        /// <summary>
        /// Constructor for contracts with lenght range definition.
        /// </summary>
        /// <param name="minLenght">Minimum password lenght.</param>
        /// <param name="maxLenght">Maximum password lenght</param>
        /// <exception cref="Argument exception">If lenght isn't up to 0 or minimum is major of maximum.</exception>
        public Contract(int minLenght, int maxLenght)
        {
            if ((minLenght <= 0) || (maxLenght <= 0) || (minLenght > maxLenght))
                throw new ArgumentException();
            _min = minLenght;
            _max = maxLenght;
            numerics = 0;
            upcases = 0;
            symbols = 0;
        }
    }
}
